@extends('admin/layout')

@if($script_blade = 'news/add' )@endif

@section('content')
    <div class="page-header clearfix">
        <h1 class="pull-left">{{ $title or '添加' }}资讯</h1>
    </div>
    <form action="@if( $action == 'update' ) {{ url('admin/news/'.$data->id) }} @else {{ url('admin/news/') }} @endif" method="post" id="pub-form">
        <div class="row">
            <div class="col-md-8">
                <div class="form-group">
                    <label for="title">资讯标题</label>
                    <input type="text" name="title" id="title" class="form-control" value="{{ $data->title or ''}}"/>
                </div>
                <div class="form-group">
                    <label for="cid">所属栏目</label>
                    <select class="form-control" name="cid" id="cid">
                        <option value="">选择栏目</option>
                        <option value="1">php</option>
                        <option value="2">java</option>
                        <option value="3">python</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="ue-container">正文</label>
                    <textarea name="content" id="ue-container">{{ $data->content or ''}}</textarea>
                </div>
            </div>
            <div class="col-md-4">
                <div class="panel panel-default">
                    <div class="panel-heading">来源设置</div>
                    <div class="panel-body">
                        <div class="form-group">
                            <label for="from">来源名称</label>
                            <input type="text" name="" id="from" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label for="fromUrl">来源URL</label>
                            <input type="text" name="fromUrl" id="fromUrl" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">发布时间</div>
                    <div class="panel-body">
                        <div class="form-group">
                            <div class='input-group date' id='datetimepicker'>
                                <input type='text' class="form-control" value="{{ $data->createTime or date('Y-m-d H:i:s') }}" name="createTime"/>
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <span class="mt-10"></span>

        <div class="row">
            <div class="col-md-12">
                <button class="btn btn-primary" type="submit">确定</button>
                <a href="{{ url('admin/news') }}" class="btn btn-link">返回</a>
            </div>
        </div>
        @if($action == 'update') <input type="hidden" name="_method" value="PUT"/> @endif
        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
    </form>
@endsection